package com.liuguang.common.annotations;


import com.liuguang.common.validator.IsMobileValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

@Target({ElementType.FIELD,ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {IsMobileValidator.class})
/**
 *
 *  自定义注解：默认即使使用该注解也不会验证，当require 为 true 时候进行验证
 */
public @interface IsPhoneNumber {
    boolean require() default false;

    String message() default "格式有误，必须是手机号格式";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
